<template>
  <div>
    <NavBar></NavBar>
    <div class="menu">
      <div class="menu-title">
        <i class="el-icon-position">房产经纪</i>
      </div>
      <div class="flex">
        <div class="menu-content" v-for="item in agentList" :key="item.id">
          <div class="left">
            <img :src="item.image" alt="" />
          </div>
          <div class="right">
            <h5>{{ item.title }}</h5>
            <div class="right-content">
              {{ item.desc }}
            </div>
          </div>
        </div>
      </div>
    </div>
    <Footer v-if="agentList.length"></Footer>
  </div>
</template>

<script>
import { getAgentList } from "@/api/agent";
export default {
  data() {
    return {
      agentList: [],
    };
  },
  async created() {
    this.agentList = await getAgentList();
    console.log("房产列表", this.agentList);
  },
};
</script>


<style lang="less" scoped>
.menu {
  // padding-bottom: 200px;
  width: 1000px;
  margin: 20px auto;
}
.menu-title {
  padding: 10px 0;
  color: orange;
}
.flex {
  display: flex;
  flex-wrap: wrap;
}
.menu-content {
  background-color: #fff;
  margin: 10px;
  height: 400px;
  width: 31%;
  display: flex;
  flex-direction: column;
  text-align: center;
  // border: 1px solid #ccc;
  &:hover {
    box-shadow: 3px 2px 5px 2px #ccc;
  }
  .left {
    height: 280px;
    overflow: hidden;
    img {
      width: 100%;
      height: 350px;
      object-fit: cover;
      padding: 5px 10px;
    }
  }
  .right {
    flex: 1;
    padding: 5px 10px;
    h5 {
      text-align: center;
      font-weight: 700;
      line-height: 30px;
    }
    .right-content {
      line-height: 20px;
    }
  }
}
</style>